package com.kunya.product.dao.cart;


import com.kunya.product.po.Cart;
import org.apache.ibatis.annotations.Param;
import java.util.List;

public interface CartMapper {
    int deleteByPrimaryKey(@Param("userId") Long cartId,@Param("table_prefix") String table_prefix);

    int insert(@Param("cart") Cart cart,@Param("table_prefix") String table_prefix);

    int insertSelective(@Param("cart") Cart cart,@Param("table_prefix") String table_prefix);

    Cart selectByPrimaryKey(@Param("userId") Long cartId,@Param("table_prefix") String table_prefix);

    int updateByPrimaryKeySelective(@Param("cart") Cart cart,@Param("table_prefix") String table_prefix);

    int updateByPrimaryKey(@Param("cart") Cart cart,@Param("table_prefix") String table_prefix);
    //根据商品规格属性编号和用户id查询购物车
    Cart selectCartByUserIdProductSpecNumber(@Param("productSpecNumber") Long productSpecNumber,@Param("userId") Long userId,@Param("table_prefix") String table_prefix);
    // 根据用户Id查询 cart列表
    List<Cart> selectCartByUserId(@Param("userId") Long userId,@Param("table_prefix") String table_prefix);
    //查询购物车中未勾选商品数量
    int selectCartProductCheckedStatusByUserId(@Param("userId") Long userId,@Param("table_prefix") String table_prefix);
    //删除所选的购物车商品
    int deleteByUserIdAndProductSpecNumbers(@Param("userId")Long userId,@Param("productList")List<String> productList,@Param("table_prefix") String table_prefix);
    //选择或者反选商品
    int checkedOrUncheckedProduct(@Param("userId") Long  userId,@Param("productSpecNumber")Long productSpecNumber,@Param("checked") Byte checked,@Param("table_prefix") String table_prefix);
    //查询购物车中商品数量
    int selectCartProductCount(@Param("userId") Long userId,@Param("table_prefix") String table_prefix);
}